#ifndef ABSTRACT_FACTORY_H
#define ABSTRACT_FACTORY_H

#include <iostream>

class Window {
};

class PMWindow : public Window {
public:
  PMWindow() {
    std::cout << "PMWindow" << std::endl;
  }
};

class MotifWindow : public Window {
public:
  MotifWindow() {
    std::cout << "MotifWindow" << std::endl;
  }
};

class ScrollBar {
};

class PMScrollBar : public ScrollBar {
public:
  PMScrollBar() {
    std::cout << "PMScrollBar" << std::endl;
  }
};

class MotifScrollBar : public ScrollBar {
public:
  MotifScrollBar() {
    std::cout << "MotifScrollBar" << std::endl;
  }
};

class WidgetFactory {
public:
  virtual ScrollBar* CreateScrollBar() = 0;
  virtual Window* CreateWindow() = 0;
};

class PMWidgetFactory : public WidgetFactory {
public:
  PMWidgetFactory() {
    std::cout << "PMWidgetFactory" << std::endl;
  }

  ScrollBar* CreateScrollBar() {
    return new PMScrollBar();
  }

  Window* CreateWindow() {
    return new PMWindow();
  }
};

class MotifWidgetFactory : public WidgetFactory {
public:
  MotifWidgetFactory() {
    std::cout << "MotifWidgetFactory" << std::endl;
  }

  ScrollBar* CreateScrollBar() {
    return new MotifScrollBar();
  }

  Window* CreateWindow() {
    return new MotifWindow();
  }
};

#endif // ABSTRACT_FACTORY_H
